package ThreadOperation;

public class ThreadPriority
{
    public static void main(String[] args)
    {
        System.out.println("主线程优先级"+Thread.currentThread().getName()+"---->"+Thread.currentThread().getPriority());
        Priority p=new Priority();
        Thread t0=new Thread(p);
        Thread t1=new Thread(p);
        Thread t2=new Thread(p);
        Thread t3=new Thread(p);

        t0.start();//t0直接开始执行
        t1.setPriority(1);
        t1.start();//t1优先级为1
        t2.setPriority(7);
        t2.start();//t2优先级为7
        t3.setPriority(6);
        t3.start();//t3优先级为6
    }
}
class Priority implements Runnable
{
    @Override
    public void run()
    {
        System.out.println(Thread.currentThread().getName()+"---->"+Thread.currentThread().getPriority());
    }
}
